var xtProvinceWinEdit;
var xtProvinceFormEdit;
function updateXtProvince(){
	var record = grid.getSelectionModel().selected;
	if(record.length == 0){
		msgTishi('请选择要修改的一项！');
		return;
	}
	initXtProvinceFormEdit();
	xtProvinceWinEdit = Ext.create('Ext.Window',{
		layout:'fit',
		width:800,
		height:400,
		maximizable:true,
		minimizable:true,
		animateTarget:document.body,
		plain:true,
		modal:true,
		title:'编辑信息',
		listeners:{
			minimize:function(win,opts){
				if(!win.collapse()){
					win.collapse();
				}else{
					win.expand();
				}
			}
		},
		items:xtProvinceFormEdit,
		buttons:[{
			text:'保存',
			itemId:'save',
			handler:function(button){
				submitForm(xtProvinceFormEdit,'../xtProvinceController/updateXtProvince',grid,xtProvinceWinEdit,false,true);
			}
		},{
			text:'关闭',
			itemId:'close',
			handler:function(button){
				button.up('window').close();
			}
		}]
	});
	xtProvinceWinEdit.show();
	loadFormData(xtProvinceFormEdit,'../xtProvinceController/getXtProvinceById?xt_provinceID='+ record.items[0].data.xt_provinceID);
}
function initXtProvinceFormEdit(){
	xtProvinceFormEdit = Ext.create('Ext.FormPanel',{
		xtype:'form',
		waitMsgTarget:true,
		defaultType:'textfield',
		autoScroll:true,
		fieldDefaults:{
			labelWidth:70,
			labelAlign:'left',
			flex:1,
			margin:'2 5 4 5'
		},
		items:[
		{
			fieldLabel:'省份序列号',
			xtype:'textfield',
			hidden:true,
			name:'xt_provinceID',
			allowBlank:false,
			maxLength:32,
			anchor:'100%'
		},
		{
			fieldLabel:'省份名称',
			xtype:'textfield',
			name:'xt_provinceName',
			maxLength:20,
			anchor:'40%'
		},
		{
			fieldLabel:'上级编号',
			xtype:'textfield',
			name:'xt_provinceUpID',
			maxLength:20,
			hidden:true,
			anchor:'100%'
		},
		{
			fieldLabel:'',
			xtype:'textfield',
			name:'xt_provinceUpIdNum',
			maxLength:32,
			hidden:true,
			anchor:'100%'
		},
		{
			fieldLabel:'路&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;径',
			xtype:'textfield',
			name:'xt_provincePath',
			maxLength:100,
			anchor:'100%'
		},
		{
			fieldLabel:'型&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;类',
			xtype:'textfield',
			name:'xt_provinceType',
			maxLength:20,
			anchor:'40%'
		},
		{
			fieldLabel:'',
			xtype:'numberfield',
			value:'0',
			hidden:true,
			name:'xt_provinceTypeNum',
			anchor:'100%'
		},
		{
			fieldLabel:'简&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称',
			xtype:'textfield',
			name:'xt_provinceShortName',
			maxLength:11,
			anchor:'40%'
		},
		{
			fieldLabel:'拼&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;音',
			xtype:'textfield',
			name:'xt_provinceSpell',
			maxLength:11,
			anchor:'40%'
		},
		{
			fieldLabel:'',
			xtype:'textfield',
			name:'xt_provinceAreaId',
			maxLength:11,
			hidden:true,
			anchor:'100%'
		},
		{
			fieldLabel:'邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;编',
			xtype:'textfield',
			name:'xt_provincePostCode',
			maxLength:11,
			anchor:'40%'
		}
		]
	});
}
